//
//	ZcoModelCMD.m
//	Model file generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport



#import "ZcoModelCMD.h"
NSString *const kZcoModelCMDCmd = @"cmd";
NSString *const kZcoModelCMDType = @"type";
NSString *const kZcoModelCMDData = @"data";
NSString *const kZcoModelCMDAskForPermission = @"askForPermission";
NSString *const kZcoModelCMDCmdId = @"cmdId";
NSString *const kZcoModelCMDCreatedAt = @"createdAt";
NSString *const kZcoModelCMDStatus = @"status";
NSString *const kZcoModelCMDReason = @"reason";

@interface ZcoModelCMD ()
@end
@implementation ZcoModelCMD




/**
 * Instantiate the instance using the passed dictionary values to set the properties values
 */

-(instancetype)initWithDictionary:(NSDictionary *)dictionary
{
	self = [super init];
    if (![dictionary[kZcoModelCMDData] isKindOfClass:[NSNull class]]) {
        self.data = dictionary[kZcoModelCMDData];
    }
	if(![dictionary[kZcoModelCMDCmd] isKindOfClass:[NSNull class]]){
		self.cmd = dictionary[kZcoModelCMDCmd];
	}	
	if(![dictionary[kZcoModelCMDType] isKindOfClass:[NSNull class]]){
		self.type = dictionary[kZcoModelCMDType];
	}
    if(![dictionary[kZcoModelCMDStatus] isKindOfClass:[NSNull class]]){
        self.status = dictionary[kZcoModelCMDStatus];
    }
    if(![dictionary[kZcoModelCMDReason] isKindOfClass:[NSNull class]]){
        self.reason = dictionary[kZcoModelCMDReason];
    }
    if(![dictionary[kZcoModelCMDAskForPermission] isKindOfClass:[NSNull class]]){
        self.askForPermission = [dictionary[kZcoModelCMDAskForPermission] boolValue];
    }
    if(![dictionary[kZcoModelCMDCmdId] isKindOfClass:[NSNull class]]){
        self.cmdId = [dictionary[kZcoModelCMDCmdId] integerValue];
    }
    if(![dictionary[kZcoModelCMDCreatedAt] isKindOfClass:[NSNull class]]){
        self.createdAt = dictionary[kZcoModelCMDCreatedAt];
    }
	return self;
}


/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
-(NSDictionary *)toDictionary
{
	NSMutableDictionary * dictionary = [NSMutableDictionary dictionary];
    if (self.data != nil) {
        dictionary[kZcoModelCMDData] = self.data ;
    }
	if(self.cmd != nil){
		dictionary[kZcoModelCMDCmd] = self.cmd;
	}
	if(self.type != nil){
		dictionary[kZcoModelCMDType] = self.type;
	}
    if(self.status != nil){
        dictionary[kZcoModelCMDStatus] = self.status;
    }
    if(self.reason != nil){
        dictionary[kZcoModelCMDReason] = self.reason;
    }
    dictionary[kZcoModelCMDAskForPermission] = @(self.askForPermission);
    dictionary[kZcoModelCMDCmdId] = @(self.cmdId);
    if(self.createdAt != nil){
        dictionary[kZcoModelCMDCreatedAt] = self.createdAt;
    }
	return dictionary;

}

/**
 * Implementation of NSCoding encoding method
 */
/**
 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
 */
- (void)encodeWithCoder:(NSCoder *)aCoder
{
	if(self.cmd != nil){
		[aCoder encodeObject:self.cmd forKey:kZcoModelCMDCmd];
	}
	if(self.type != nil){
		[aCoder encodeObject:self.type forKey:kZcoModelCMDType];
	}
    if(self.status != nil){
        [aCoder encodeObject:self.status forKey:kZcoModelCMDStatus];
    }
    if(self.reason != nil){
        [aCoder encodeObject:self.reason forKey:kZcoModelCMDReason];
    }
    [aCoder encodeObject:@(self.askForPermission) forKey:kZcoModelCMDAskForPermission];
    [aCoder encodeObject:@(self.cmdId) forKey:kZcoModelCMDCmdId];
    if(self.createdAt != nil){
        [aCoder encodeObject:self.createdAt forKey:kZcoModelCMDCreatedAt];
    }

}

/**
 * Implementation of NSCoding initWithCoder: method
 */
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
	self = [super init];
	self.cmd = [aDecoder decodeObjectForKey:kZcoModelCMDCmd];
	self.type = [aDecoder decodeObjectForKey:kZcoModelCMDType];
    self.status = [aDecoder decodeObjectForKey:kZcoModelCMDStatus];
    self.reason = [aDecoder decodeObjectForKey:kZcoModelCMDReason];
    self.askForPermission = [[aDecoder decodeObjectForKey:kZcoModelCMDAskForPermission] boolValue];
    self.cmdId = [[aDecoder decodeObjectForKey:kZcoModelCMDCmdId] integerValue];
    self.createdAt = [aDecoder decodeObjectForKey:kZcoModelCMDCreatedAt];
	return self;
}

/**
 * Implementation of NSCopying copyWithZone: method
 */
- (instancetype)copyWithZone:(NSZone *)zone
{
	ZcoModelCMD *copy = [ZcoModelCMD new];
	copy.cmd = [self.cmd copy];
	copy.type = [self.type copy];
    copy.status = [self.status copy];
    copy.reason = [self.reason copy];
    copy.askForPermission = self.askForPermission;
    copy.cmdId = self.cmdId;
    copy.createdAt = [self.createdAt copy];
	return copy;
}

@end
